//
//  ApplyInDetailCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/8/29.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "ApplyInDetailCell.h"

@implementation ApplyInDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.pictureView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.pictureView];
        [self.pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(30));
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(20));
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-20));
            make.height.mas_equalTo(scaleTopAndBottom(180));
        }];
        self.pictureView.image = [UIImage imageNamed:@"大"];
//        UILabel *descripLable = [[UILabel alloc] init];
//        descripLable.text = @"详细描述";
//        [self.contentView addSubview:descripLable];
//        [descripLable mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(20));
//            make.top.equalTo(_pictureView.mas_bottom).offset(scaleTopAndBottom(10));
//            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-20));
//            make.height.mas_equalTo(scaleTopAndBottom(20));
//        }];
        self.descriptextVeiw = [[UITextView alloc] init];
        self.descriptextVeiw.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.descriptextVeiw];
        [self.descriptextVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(20));
            make.top.equalTo(_pictureView.mas_bottom).offset(scaleTopAndBottom(10));
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-20));
            make.height.mas_equalTo(scaleTopAndBottom(100));
        }];
        self.placeHolder = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, scaleLeftAndRight(150), 15)];
        self.placeHolder.font = [UIFont systemFontOfSize:14];
        self.placeHolder.text = @"简单介绍作品";
        self.placeHolder.textColor = COLOR_HEX(0xC0C0C0);
        [self.descriptextVeiw addSubview:self.placeHolder];
        self.stirngLenghLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.stirngLenghLabel.textColor = COLOR_HEX(0xADADAD);
        self.stirngLenghLabel.textAlignment = NSTextAlignmentRight;
        self.stirngLenghLabel.text = @"0/255";
        self.stirngLenghLabel.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:self.stirngLenghLabel];
        [self.stirngLenghLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.descriptextVeiw.mas_right);
            make.bottom.equalTo(self.descriptextVeiw.mas_bottom);
            make.width.mas_equalTo(scaleLeftAndRight(100));
            make.height.mas_equalTo(scaleTopAndBottom(15));
        }];
        self.pictureView.userInteractionEnabled = YES;
        
        self.deleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.deleBtn setTitle:@" 删除" forState:UIControlStateNormal];
        self.deleBtn.titleLabel.font = [UIFont systemFontOfSize:13];
        [self.deleBtn setTitleColor:COLOR_HEX(0xFFC921) forState:UIControlStateNormal];
        [self.deleBtn setImage:[UIImage imageNamed:@"删除／数字面板编辑态-2"] forState:UIControlStateNormal];
        [self.contentView addSubview:self.deleBtn];
        [self.deleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(0));
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(5));
            make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(100), scaleTopAndBottom(20)));
        }];

//        self.descriptextVeiw.backgroundColor = [UIColor cyanColor];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
